
// 导入路由处理函数 

const {handleReg,handleLogin,handleInfo,handleUpdate,handlePassword,handleOut,handleList} = require('../controller/users')

const  {checkParams,checkPassword} = require('../middleware/users')
const {checkToken} = require('../middleware')




// 创建空表
const  router = require('express').Router()


// 添加内容 
// 注册
router.post('/register',checkParams,handleReg)

// 登录  
router.post('/login',handleLogin)

// 获取个人信息  

router.get('/info',checkToken,handleInfo)

// 修改个人信息 

router.post('/update',checkToken,handleUpdate)

//修改密码
router.post('/editpassword',checkToken,checkPassword,handlePassword)

//退出登录
router.get('/logout',handleOut)

//获取用户
router.get('/list',handleList)


module.exports = router